home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2001 September / PC-WELT 9-2001.ISO / software / hw / brennen / flask_src.exe / Audio / AC3 / AC3Dec / dither.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-06  |  1.1 KB  |  38 lines

  1. /* 
  2.  *    dither.h
  3.  *
  4.  *    Copyright (C) Aaron Holtzman - May 1999
  5.  *
  6.  *  This file is part of ac3dec, a free Dolby AC-3 stream decoder.
  7.  *    
  8.  *  ac3dec is free software; you can redistribute it and/or modify
  9.  *  it under the terms of the GNU General Public License as published by
  10.  *  the Free Software Foundation; either version 2, or (at your option)
  11.  *  any later version.
  12.  *   
  13.  *  ac3dec is distributed in the hope that it will be useful,
  14.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  *  GNU General Public License for more details.
  17.  *   
  18.  *  You should have received a copy of the GNU General Public License
  19.  *  along with GNU Make; see the file COPYING.  If not, write to
  20.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  21.  *
  22.  */
  23.  
  24.  
  25. extern uint_16 lfsr_state;
  26. extern const uint_16 dither_lut[256]; 
  27.  
  28. static inline uint_16 dither_gen(void)
  29. {
  30.     sint_16 state;
  31.  
  32.     state = dither_lut[lfsr_state >> 8] ^ (lfsr_state << 8);
  33.     
  34.     lfsr_state = (uint_16) state;
  35.  
  36.     return ((state * (sint_32) (0.707106 * 256.0))>>8);
  37. }
  38.